#include <condition_variable>
#include <iostream>
#include <vector>
#include <chrono>
#include <thread>
#include <atomic>
using namespace std;
atomic_int numTest(0);
//int numTest(0);
class Test
{
public:    
    Test()
    {
        for(int i = 0; i < 7; i++)
        {
            thread* t = new thread(&Test::threadFunc, this);
            t->detach();
            threads_.push_back(t);
        }
    }
    ~Test()
    {
        for(int i = 0; i < 7; i++)
        {
            //threads_[i]->join();
        }
    }

    void threadFunc()
    {
        //cout << "threadFunc start" << endl;
        unique_lock<mutex> lck(condMutex_);
        //lock_guard<mutex> lck(condMutex_);
        cond_.notify_all();
        numTest++;
    }

    condition_variable cond_;
    mutex condMutex_;
    vector<thread*> threads_; 
};

int main()
{
    Test();
    
    this_thread::sleep_for(chrono::seconds(5));
    cout << numTest << endl;
    

    while(1);
    //getchar();
    return 0;
}